1. Field of the Invention
The present invention relates to a computer system, and deals more particularly with a method, system, and computer program product for using Java Server Pages to achieve application-specific document content. The disclosed technique enables the Java Server Page application author to have more control over the content of a client-requested document generated by this application.
2. Description of the Related Art
xe2x80x9cTranscodingxe2x80x9d is a technique well known in the art. In general, a transcoder translates or transforms the content of a document or file, resulting in creation of a different document or file. In the Internet and World Wide Web environments, transcoding is used in a number of ways. As one example, transcoding may be used to transform a full-color graphic image that is embedded within a Web document into a grayscale image, in order to reduce the size of the information content before transmitting it from a server to a client that has requested the document. As another example, an HTML (HyperText Markup Language) document may be translated into an XML (Extensible Markup Language) document before transmitting it to a client. Many other examples of transcoding can be envisaged by one of skill in the art.
Servlets have proven to be a powerful tool in generation of dynamic Web content. A servlet is a program typically written in the Java object-oriented programming language. (Java is a trademark of Sun Microsystems, Inc., referred to hereinafter as xe2x80x9cSunxe2x80x9d.) A servlet is created in a way that allows it to be easily added to the code already running on a server, and is intended to extend the functionality provided by the server. A servlet typically implements code to perform a specific task, such as retrieving information from a particular type of database, performing some business application function, or performing a particular type of transcoding operation. When used for transcoding, a servlet may operate upon a static document (that is, a document having a predefined content) to change the content of this document into another form, in the manner discussed above (i.e. operating upon images, translating from one syntax to another, etc.) Servlets may also be used to dynamically generate the content, or portions of the content, for a requested Web page. For example, run-time information may be obtained by an executing servlet, such as the identification of the client requesting the document; this dynamically-obtained information can then be used when generating the output document to be returned to the client (such as inserting a client-specific greeting in the document; tailoring the document format according to stored preferences for this client; etc.).
Sun Microsystems, Inc. has recently defined a server-side scripting language known as xe2x80x9cjavaServer Pagesxe2x80x9d, or xe2x80x9cJSPxe2x80x9d. This JSP language provides access to the servlet API (Application Programming Interface), the Java API, and the JavaBeans API. The JSP model simplifies the development of servlets by enabling servlet code to use a scripting paradigm, thereby enabling software developers to more easily build applications that generate Web content dynamically. The deployment of servlets is also made simpler, as all that is required when using JSP is to invoke a Web document (such as an HTML page or XML document) that contains JSP code embedded within it. The referenced servlet code will then be invoked automatically, by the JSP processing engine, as the Web document is being processed. (As is known in the art, invocation of a Web page is typically done by transmitting an HTTP, or HyperText Transfer Protocol, GET request from a client to a Web server, where this GET request specifies the Uniform Resource Locator, or URL, used to locate the desired page.) By incorporating the xe2x80x9cWrite Once, Run Anywherexe2x80x9d vision of the Java programming language, JSPs allow servlets to be defined by scripts that may be easily accessed by Web application servers. A further advantage of JSPs is that the servlet registration process, which varies from one server to another, is no longer required. (xe2x80x9cJavaServer Pagesxe2x80x9d, xe2x80x9cJSPxe2x80x9d, xe2x80x9cJava Beansxe2x80x9d, and xe2x80x9cWrite Once, Run Anywherexe2x80x9d arm trademarks of Sun Microsystems. Inc.)
Under this distributed computing model where transcoding is performed by servlets, the transcoding engine is a filter in the output stream of the application server (or Web server). This transcoding engine typically has access to characteristics about the source of the input request. (These characteristics are also referred to herein as the xe2x80x9ctarget contextxe2x80x9d of a requested document, as the requester of the document is also typically the target of the output document.) Examples of the input source characteristics are: the type of user agent (e.g. a browser) from which a document was requested; the type of device on which the user agent is operating; the type of network connection over which the requesting device is connected; etc. Some aspects of this input source characteristic information may be available to a servlet operating at the Web server from which a requested document is being deployed; other aspects of the information may be available only at intermediaries in the distributed network (such as the gateway into a wireless or wired network, transcoding proxies, or transcoding servers) in a complex delivery chain between this deploying Web server and the requesting client. The transcoding engine may use these input source characteristics to choose the type of transformation it will perform on the output document, in order to transform the requested content into a form adapted specifically to the target environment in which it will be rendered for the requesting user. The filter can exist anywhere in the overall output network path to the requesting device, as stated above, but an ideal location is at the application server itself. When the filter is located at the application server, it can be coupled to the application generating the output document, enabling high-speed, efficient transcoding.
While there are many embodiments of transcoding possible, as has been stated, one which has emerged as significant in the enterprise computing marketplace is built using an Extensible Stylesheet Language (xe2x80x9cXSLxe2x80x9d) processor which uses an XSL style sheet to transform an XML document into almost any target formatxe2x80x94including a new XML document. U.S. Pat. No. 6,463,440 (Ser. No. 09/287,988, filed Apr. 8, 1999), titled xe2x80x9cRetrieval of Style Sheets from Directories Based Upon Partial Characteristic Matchingxe2x80x9d (hereinafter, xe2x80x9cthe referenced inventionxe2x80x9d), discloses a technique whereby an appropriate XSL style sheet can be dynamically selected and retrieved for use by an XSL transcoding engine in order to tailor an output document to the characteristics of the source of the input request. (Refer to xe2x80x9cExtensible Stylesheet Language (XSL), W3C Working Draft 21 April 1999xe2x80x9d and xe2x80x9cXSL Transformations (XSLT), Version 1.0, W3C Working Draft 9 July 1999xe2x80x9d, which are available on the Web at http://www.w3.org/TR/WD-xsl and http://www.w3.org/TR/WD-xslt, respectively, for more information on using XSL for formatting and transforming documents.)
One of the limiting factors of this transcoding model to date is that only the input source request characteristics are used for style sheet selection, and thus to influence the content of the output document, along with very limited information about the characteristics of the application generating the output document. In particular, only the Document Type Definition (xe2x80x9cDTDxe2x80x9d) of the XML document being transformed is available as this type of application characteristic for use by the transcoding filter. Typically, an entire family of different applications will share a single DTD, yet the transformation to be performed at the transcoding filter would ideally be modified based upon application-specific characteristics. For example, a consortium of banks might define a single DTD for all banking products, such as: statements for savings accounts, checking accounts, loans, or certificates of deposit; monthly account statements; loan requests; account balance inquiries; etc. Thus, the DTD provides only a high-level, generic means of influencing the output document. As will be obvious, the type of information that would preferably be generated by the application for a loan request form is quite different than what would be generated for a monthly statement. Another example of the advantage of using application-specific characteristics to transcode a document can be seen in the scenario where a transcoding filter is processing an HTML document, converting the input page into an XML document using a generic HTML-to-XML transcoding process where the XML document is then processed by applying XSL style sheets in an XSL engine. In this scenario, a single DTD is the only application characteristic available to the transcoding process; hence, all HTML web applications using this scenario would receive the same generic transformations (plus the ability to use a given set of input request characteristics to further transform the output for the target context).
In view of the advantageous aspects of using JSPs as discussed above, it would be desirable to incorporate JSPs in transcoding environments. There is currently no known technique for providing this capability. Accordingly, what is needed is a technique with which a JSP author can specify application-specific characteristics to be used in the transcoding process, enabling the transcoding engine to generate output that is more precisely tailored for the requesting user.
An object of the present invention is to provide a technique for incorporating application-specific characteristics in the transcoding process.
Another object of the present invention is to provide this technique whereby the JSP author can more precisely control the output generated by his application in response to a particular client request.
Yet another object of the present invention is to provide this technique by providing a capability for the JSP author to override input request source information.
A further object of the present invention is to provide this technique by providing a capability for the JSP author to insert additional application-specific characteristics into a document to be transcoded.
Another object of the present invention is to provide this technique whereby the overridden context and/or the inserted characteristic information can be used to select an appropriate style sheet for the transcoding process.
Still another object of the present invention is to provide this technique in a backward-compatible manner, such that existing style sheets continue to function properly.
Other objects and advantages of the present invention will be set forth in part in the description and in the drawings which follow and, in part, will be obvious from the description or may be learned by practice of the invention.
To achieve the foregoing objects, and in accordance with the purpose of the invention as broadly described herein, the present invention provides a method, system, and computer program product for use in a computing environment, for achieving application-specific document content in the transcoding environment using Java Server Pages. This technique further comprises: retrieving an input Java Server Pages (JSP) document representing a response to a user request, the input document specifying one or more transcoding directives, and executing a JSP engine adapted to processing the transcoding directives. Executing the JSP engine preferably further comprises: locating the transcoding directives in the input document, each of the located transcoding directives comprising one or more overriding keyword/value pairs; determining a target context of the user request, the target context comprising one or more context keyword/value pairs; comparing each of the overriding keyword/value pairs to the context keyword/value pairs; and replacing a context value from a selected one of the context keyword/value pairs with an override value from a selected one of the override keyword/value pairs when the selected context pair and the selected override pair have a matching keyword value. After executing the JSP engine, the context keyword/value pairs, as modified, are used to generate a tailored output version of the input document.
Using the context keyword/value pairs may further comprise executing a transcoding filter. The input document may further comprise one or more transcoding hints, and the technique may further comprise applying these transcoding hints to further refine the tailored output version.
Applying the transcoding hints may further comprise: using the transcoding hints to select one or more appropriate style sheets; and executing a transcoding filter which applies the selected style sheets to the input document. Or, applying the transcoding hints may further comprise: using the transcoding hints and the context keyword/value pairs, as modified by the replacing operation, to select one or more appropriate style sheets; and executing a transcoding filter which applies the selected style sheets to the input document. The style sheets may be specified in an Extensible Stylesheet Language (XSL) notation.
The present invention will now be described with reference to the following drawings, in which like reference numbers denote the same element throughout.